// pages/square/index.js
const app = getApp();
var topOpacity = 0;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 组件参数设置，传递到组件
    defaultData: {
      title: "麓客广场", // 导航栏标题
      showHome: false, //是否显示回到首页按钮
      showBack: false, //是否显示返回按钮
      showLogo: false, //是否显示logo
      bgColor: 'transparent'
    },
    baseUrl: app.baseUrl,
    version: app.globalData.version,
    navBarHeight: app.globalData.navBarHeight,
    showControlDom: false,
    authData: {
      authType: '0', //0表示使用登录弹窗  1表示使用完善昵称头像弹窗 2表示直接弹出头像昵称选择框
      authUsername: "false", //是否已经授权头像昵称
    },
    showLogin: false, //是否显示授权弹窗
    showWsInfoDom: false, //直接显示头像昵称弹窗
    showPrivacyFlag: app.globalData.showPrivacyFlag,

    bannerList: [],
    targetList: [],
    partTypeList:[
      {
        id:0,
        name:'团购局',
        childList:[
          {
            id:0,
            name:'全部'
          },
          {
            id:1,
            name:'求助'
          },
          {
            id:2,
            name:'健康'
          },
          {
            id:3,
            name:'科技'
          },
          {
            id:4,
            name:'生活小知识'
          },
          {
            id:5,
            name:'职场技能'
          }
        ]
      }
    ],
    curPartId:-1,
    curChildPartId:0,
    gameList: [],
    swiperIndex: 0,
    listType: 0,
    forumList: [],
    forumListJs: [],
    forumListGl: [],
    isHeightMode: false,

    openid: '',
    is_nickAndHead: 0,
    shareTitle: '',
    shareImg: '',

    sort: 1, //1:最新 2：最热
    page: 1, //当前页数
    pageJs: 1, //家书的当前页数
    pageGl: 1, //家书的当前页数
    isLoadingEnd: 0, //0:数据未加载完 1:数据已加载完
    isLoadingEndJs: 0, //0:数据未加载完 1:数据已加载完---家书
    isLoadingEndGl: 0, //0:数据未加载完 1:数据已加载完---家书
    is_one_js: 1, //是否第一次加载家书列表
    is_one_gl: 1, //是否是第一次加载攻略
    headerUrl: '',

    bigCate:'',//组局选择的大分类
    smallCate:'',//组局选择的小分类

    isHaveMore: true,
    userId:''
  },
  onPageScroll(t) {
    if (t.scrollTop < 40) {
      topOpacity = 0
      if (this.data.topOpacity != 0) {
        this.setData({
          topOpacity: 0
        })
      }
    } else if (t.scrollTop >= 40) {
      if (topOpacity <= 1) {
        topOpacity = t.scrollTop / 100 - .4
      } else {
        topOpacity = 1
      }
      if (topOpacity <= 1) {
        this.setData({
          topOpacity: topOpacity
        })
      }
    }
  },
  //点击组局类别
  choosePartType(e){
    var that = this;
    var id = e.currentTarget.dataset.id;
    var bigCate = e.currentTarget.dataset.name;
    var smallCate = that.data.partTypeList[id].childList[0]['name'];
   
    console.log(smallCate);
    that.setData({
      curPartId:id,
      bigCate:bigCate,
      smallCate:smallCate,
      curChildPartId:0//默认选中第一个选项
    });
    //更新数据
    that.getGameList(bigCate,smallCate,1);
  },
  //点击组局二级类别
  chooseChildPart(e){
    var that = this;
    var id = e.currentTarget.dataset.id;
    var smallCate = e.currentTarget.dataset.name;
    that.setData({
      curChildPartId:id,
      smallCate:smallCate
    });
    //更新数据
     that.getGameList(that.data.bigCate,smallCate,1);
  },

  //点击组局大分类和小分类后后台请求更新列表 flag=0 查看全部  flag=1 查看某个分类列表
  getGameList(bigCate,smallCate,flag) { 
    var that = this;

    wx.showLoading({
      title: '数据切换中...'
    });

    wx.request({
      url: that.data.baseUrl + 'getGameList.php',
      method: 'POST',
      data: {
        bigCate: bigCate,
        smallCate:smallCate,
        flag:flag
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        wx.hideLoading();
        if (res.data.status == 1) {
          //后台请求成功
          that.setData({
            gameList: res.data.gameList,
          });
        } else {
          //后台请求失败
          app.showTip(res.data.msg);
          return;
        }
      },
      fail: function (res) {
        wx.hideLoading();
      }
    });
  },

  //method
  hotCircleCilck: function (event) {
    var tapId = event.currentTarget.id;
    console.log(tapId)
    wx.navigateTo({
      url: '/pages/marketing/yglDetail?id=' + tapId+"&pageFlag=1"
    })
  },
  //点击家书
  goLjs(e) {
    var id = e.currentTarget.dataset.id;
    var url = e.currentTarget.dataset.url;
    var type = e.currentTarget.dataset.type;
    //判断是跳转微信稿还是详情页
    if (type == 0) {
      //跳转详情页
      wx.navigateTo({
        url: '/pages/marketing/ljsDetail?id=' + id
      })
    } else {
      //跳转微信稿
      wx.navigateTo({
        url: '/pages/webView/webView?wx_url=' + url
      })
    }

  },
  //这个方法是悦攻略加载更多的方法
  /*scrollTolower: function () {
    if (this.data.isHaveMore) {
      this.data.circleList = this.data.circleList.concat(this.data.moreBeauty)
      this.setData({
        circleList: this.data.circleList,
        isHaveMore: false
      })
    } else {
      wx.showToast({
        title: '没有更多了',
        icon: 'none',
        image: '',
        duration: 1000,
        mask: true,
        success: function (res) {},
        fail: function (res) {},
        complete: function (res) {},
      })
    }

  },*/
  //查看所有话题
  allTask() {
    wx.navigateTo({
      url: '/pages/square/talkList',
    })
  },
  // 查看所有组局
  allPart() {
    let that = this;
    that.setData({
      curPartId:-1
    })
    //请求列表
     that.getGameList('','',0);
  },
  swiperChange(e) {
    let that = this;
    that.setData({
      swiperIndex: e.detail.current,
    })
  },
  //点击圈子
  qz() {
    let that = this;
    that.setData({
      listType: 0,
      curPartId:-1
    })
  },
  //点击麓家书
  ljs() {
    let that = this;
    that.setData({
      listType: 2,
      curPartId:-1
    });

    //调用加载更多加载首页列表
    if (that.data.is_one_js == 1) {
      //是第一次加载家书列表
      that.getListJs(that.data.pageJs, 1, 0);
      that.setData({
        is_one_js: 0
      });
    }
  },
  //点击悦攻略
  ygl() {
    let that = this;
    that.setData({
      listType: 3,
      curPartId:-1
    });

    //调用加载更多加载首页列表
    if (that.data.is_one_gl == 1) {
      //是第一次加载家书列表
      that.getListGl(that.data.pageGl, 1, 0);
      that.setData({
        is_one_gl: 0
      });
    }
  },
  //点击麓客局
  lkj() {
    let that = this;
    that.setData({
      listType: 1,
      curPartId:-1
    })
  },
  // 预览图片
  previewImage(e) {
    let {
      sources,
      index
    } = e.currentTarget.dataset
    sources.filter(i => {
      i.type = i.type == 2 ? 'video' : 'image'
      i.poster = i.imgUrl
    })
    console.log("sources:", sources)
    wx.previewMedia({
      sources,
      current: index
    })
  },

  // 视频加载完成，改变视频的宽高
  videometa(e) {
    var that = this;
    //获取系统信息
    wx.getSystemInfo({
      success(res) {
        //视频的高
        var height = e.detail.height;

        //视频的宽
        var width = e.detail.width;

        //算出视频的比例
        var proportion = height / width;

        //res.windowWidth为手机屏幕的宽。
        var windowWidth = res.windowWidth;

        //算出当前宽度下高度的数值
        height = proportion * windowWidth;
        that.setData({
          height,
          width: windowWidth
        });
      }
    })
  },
  // 视频加载完成，改变视频的宽高
  videometa2(e) {
    var that = this;
    //获取系统信息
    wx.getSystemInfo({
      success(res) {
        //视频的高
        var height = e.detail.height;

        //视频的宽
        var width = e.detail.width;

        //算出视频的比例
        var proportion = height / width;

        //res.windowWidth为手机屏幕的宽。
        var windowWidth = 331;

        //算出当前宽度下高度的数值
        height = proportion * windowWidth;
        that.setData({
          height,
          width: windowWidth
        });
      }
    })
  },

  // 图片加载后判断图片宽高比例
  oneImageLoad(e) {
    wx.getImageInfo({
      src: e.currentTarget.dataset.sources[0],
      success: function (res) {
        console.log(res.width, res.height); // 这里获取的宽高是正确的
        res.height >= res.width && this.setData({
          isHeightMode: true
        })
      },
      fail: function (err) {
        console.log(err);
      }
    });

  },

  //banner图跳转至话题详情
  adToDetail(e) {
    var that = this;
    var idx = e.currentTarget.dataset.index;
    that.addHeaderUrl();
    wx.redirectTo({
      url: '/pages/square/talk?tid=' + that.data.bannerList[idx].id
    });
  },

  //热门话题跳转至话题详情
  goDetail(e) {
    var that = this;
    var id = e.currentTarget.dataset.id;
    that.addHeaderUrl();
    wx.redirectTo({
      url: '/pages/square/talk?tid=' + id
    });
  },

  //跳转至帖子详情
  goPostDetail(e) {
    var that = this;
    var id = e.currentTarget.dataset.id;
    that.addHeaderUrl();
    wx.redirectTo({
      url: '/pages/square/commentDetail?id=' + id
    });
  },

  //点击头像跳转个人主页
  goOtherDetail(e) {
    var that = this;
    var userId = e.currentTarget.dataset.userid;
    var openid = e.currentTarget.dataset.openid;
    var flag = e.currentTarget.dataset.flag;
    if (flag == 1 || flag == '1') {
      //缓存跳转至麓客局
      wx.setStorageSync('listType', 1);
    }
    //判断是否是自己的主页
    if (userId == this.data.userId) {
      //跳自己的主页
      that.addHeaderUrl();
      wx.redirectTo({
        url: '/pages/square/my'
      });
    } else {
      that.addHeaderUrl();
      //跳别人的主页
      wx.redirectTo({
        url: '/pages/square/ta?userId=' + userId + "&openid=" + openid
      });
    }
  },

  //跳转至麓客局详情页
  goGameDetail(e) {
    var that = this;
    var row = e.currentTarget.dataset.index;
    var id = that.data.gameList[row].id;
    var gameUserId = that.data.gameList[row].userId;
    that.addHeaderUrl();
    //判断是否点击的是自己的组局
    if (gameUserId == that.data.userId) {
      //跳转自自己的组局
      wx.redirectTo({
        url: '/pages/square/myPart?id=' + id
      });
    } else {
      wx.redirectTo({
        url: '/pages/square/partDetail?id=' + id
      });
    }
  },

  //将回跳url写入缓存
  addHeaderUrl() {
    var headerUrlList = wx.getStorageSync('headerUrlList');
    if (headerUrlList.constructor == Array) {
      if (this.data.headerUrl == headerUrlList[headerUrlList.length - 1]) {
        //与上一个回跳链接相同则不添加
        return;
      }
      headerUrlList.push(this.data.headerUrl);
      wx.setStorageSync('headerUrlList', headerUrlList);
    } else {
      headerUrlList = [];
      headerUrlList.push(this.data.headerUrl)
      wx.setStorageSync('headerUrlList', headerUrlList);
    }
  },



  //收藏
  collect(e) {
    var that = this;

    //判断是否授权过头像昵称了
    if (that.data.is_nickAndHead == 0) {
      that.addWxInfo();
      return;
    }

    var status = e.currentTarget.dataset.status;
    var index = e.currentTarget.dataset.id;

    wx.showLoading({
      title: '数据处理中...'
    });
    wx.request({
      url: that.data.baseUrl + 'addSc.php',
      method: 'POST',
      data: {
        'openid': that.data.openid,
        'id': that.data.forumList[index].id,
        'status': status
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        wx.hideLoading();
        if (res.data.status == 1) {
          if (status == "0") {
            that.setData({
              ['forumList[' + index + '].collect.status']: "1",
              ['forumList[' + index + '].collect.num']: parseInt(that.data.forumList[index].collect.num) + 1
            })

          } else {
            that.setData({
              ['forumList[' + index + '].collect.status']: "0",
              ['forumList[' + index + '].collect.num']: parseInt(that.data.forumList[index].collect.num) - 1
            })
          }
        } else {
          app.showTip(res.data.msg);
        }
      },
      fail: function (res) {
        wx.hideLoading();
      }
    });
  },

  //处理完善信息
  addWxInfo() {
    this.setData({
      ['authData.authType']: 1,
      showLogin: true
    });
  },

  //点赞
  help(e) {
    var that = this;
    //判断是否授权过头像昵称了
    if (that.data.is_nickAndHead == 0) {
      that.addWxInfo();
      return;
    }

    var status = e.currentTarget.dataset.status;
    var index = e.currentTarget.dataset.id;

    wx.showLoading({
      title: '数据处理中...'
    });
    wx.request({
      url: that.data.baseUrl + 'addZan.php',
      method: 'POST',
      data: {
        'openid': that.data.openid,
        'id': that.data.forumList[index].id,
        'status': status
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        wx.hideLoading();
        if (res.data.status == 1) {
          if (status == "0") {
            that.setData({
              ['forumList[' + index + '].help.status']: "1",
              ['forumList[' + index + '].help.num']: parseInt(that.data.forumList[index].help.num) + 1
            })

          } else {
            that.setData({
              ['forumList[' + index + '].help.status']: "0",
              ['forumList[' + index + '].help.num']: parseInt(that.data.forumList[index].help.num) - 1
            })
          }
        } else {
          app.showTip(res.data.msg);
        }
      },
      fail: function (res) {
        wx.hideLoading();
      }
    });
  },

  //攻略点赞
  helpGl(e) {
    var that = this;
    //判断是否授权过头像昵称了
    if (that.data.is_nickAndHead == 0) {
      that.addWxInfo();
      return;
    }

    var status = e.currentTarget.dataset.status;
    var index = e.currentTarget.dataset.id;

    wx.showLoading({
      title: '数据处理中...'
    });
    wx.request({
      url: that.data.baseUrl + 'addZanGl.php',
      method: 'POST',
      data: {
        'openid': that.data.openid,
        'id': that.data.forumListGl[index].id,
        'status': status
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        wx.hideLoading();
        if (res.data.status == 1) {
          if (status == "0") {
            that.setData({
              ['forumListGl[' + index + '].is_zan']: "1",
              ['forumListGl[' + index + '].zan_number']: parseInt(that.data.forumListGl[index].zan_number) + 1
            })

          } else {
            that.setData({
              ['forumListGl[' + index + '].is_zan']: "0",
              ['forumListGl[' + index + '].zan_number']: parseInt(that.data.forumListGl[index].zan_number) - 1
            })
          }
        } else {
          app.showTip(res.data.msg);
        }
      },
      fail: function (res) {
        wx.hideLoading();
      }
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that = this;

    //清空回跳缓存
    wx.setStorageSync('headerUrlList', []);

    //赋值回跳本页的url
    that.setData({
      headerUrl: '/pages/square/index'
    });

    //获取缓存中的openid
    var openid = wx.getStorageSync('ly24_openid');

    //获取发布麓客局标识
    var listType = wx.getStorageSync('listType');
    if (listType == 1 || listType == 3) {
      //当listType为麓攻略的时候再去请求列表
      if (listType == 3) {
        that.getListGl(1, that.data.pageGl, 0);
      }

      that.setData({
        listType: listType
      });
      //清空缓存
      wx.setStorageSync('listType', 0);
    }

    if (openid == '') {
      //缓存中没有openid
      //获取所需页面信息
      wx.login({
        success: function (res) {
          if (res.code) {
            //发起网络请求
            wx.request({
              url: that.data.baseUrl + 'getOpenid.php',
              method: 'POST',
              data: {
                'code': res.code
              },
              header: {
                'content-type': 'application/x-www-form-urlencoded'
              },
              success: function (res) {
                //缓存微信openid
                wx.setStorageSync('ly24_openid', res.data.openid);
                that.setData({
                  openid: res.data.openid
                });

                //获取本页数据
                that.getSquarePageInfo(res.data.openid);
              },
              fail: function (res) {}
            });
          }
        }
      });
    } else {
      that.setData({
        openid: openid
      });

      //获取本页数据
      that.getSquarePageInfo(openid);
    }

    //调用分享
    that.getShareInfo();
  },

  //获取本页数据
  getSquarePageInfo(openid) {
    var that = this;

    wx.showLoading({
      title: '数据加载中...'
    });

    wx.request({
      url: that.data.baseUrl + 'getSquarePageInfo.php',
      method: 'POST',
      data: {
        openid: openid
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        wx.hideLoading();
        if (res.data.status == 1) {
          //后台请求成功
          that.setData({
            //mySf: res.data.mySf,
            forumList: res.data.forumList,
            targetList: res.data.targetList,
            is_nickAndHead: res.data.is_nickAndHead,
            isLoadingEnd: res.data.isLoadingEnd,
            bannerList: res.data.bannerList,
            gameList: res.data.gameList,
            partTypeList:res.data.cateList,
            userId:res.data.userId
          });
        } else {
          //后台请求失败
          app.showTip(res.data.msg);
          return;
        }
      },
      fail: function (res) {
        wx.hideLoading();
      }
    });
  },

  //获取微信分享信息
  getShareInfo() {
    var that = this;
    wx.request({
      url: that.data.baseUrl + 'getShareInfo.php',
      method: 'POST',
      data: {
        id:26,
        pid:17
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        that.setData({
          shareTitle: res.data.shareTitle,
          shareImg: res.data.shareImg
        });
      },
      fail: function (res) {}
    });
  },

  //接收子组件电话授权及头像昵称授权后后返回的值
  returnVal(e) {

    //授权完头像昵称
    this.setData({
      is_nickAndHead: e.detail.is_nickAndHead
      //['userInfo.head']: e.detail.head,
      //['userInfo.nickname']: e.detail.nickname
    });

    app.showTip('个人信息已完善');
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    var that=this;
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 3,
      })
    }

    //更新showPrivacyFlag
    this.setData({
      showPrivacyFlag: app.globalData.showPrivacyFlag
    })

     //判断是否删除了攻略帖子
    var delId = wx.getStorageSync('delGlId');
    if(delId>0&&delId!=undefined){
      let list = that.data.forumListGl;
      let row=0;
      for(var i=0;i<list.length;i++){
        if(list[i]['id']==delId){
          row=i;
          break;
        }
      }
 
      // 使用splice删除元素
      list.splice(row, 1);
      console.log(row,'row');
      console.log(list,'list');
      //重新整理列表数组
      that.setData({
        forumListGl:list
      });
      //清空缓存
      wx.setStorageSync('delGlId',0);
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  //上拉获取帖子数据
  getList(page, sort, pageAdd) {
    var that = this;
    this.setData({
      isloading: true
    });
    console.log('加载更多');
    wx.showLoading({
      title: '加载中'
    });

    wx.request({
      url: that.data.baseUrl + 'getForumList.php',
      method: 'POST',
      data: {
        'tid': 0,
        'openid': that.data.openid,
        'page': page,
        'sort': sort
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        wx.hideLoading();
        if (res.data.status == 1) {
          if (pageAdd == 1) {
            that.setData({
              page: parseInt(that.data.page) + 1
            });
          }
          that.setData({
            isLoadingEnd: res.data.isLoadingEnd,
            forumList: that.data.forumList.concat(res.data.forumList),
            isloading: false
          });
        } else {
          app.showTip(res.data.msg);
          that.setData({
            isloading: false,
            isLoadingEnd: 1
          });
        }
      },
      fail: function (res) {
        wx.hideLoading();
        that.setData({
          isloading: false,
          isLoadingEnd: 1
        })
      }
    });
  },

  //上拉获取家书数据
  getListJs(page, sort, pageAdd) {
    var that = this;
    this.setData({
      isloading: true
    });
    console.log('加载更多');
    wx.showLoading({
      title: '加载中'
    });

    wx.request({
      url: that.data.baseUrl + 'getForumListJs.php',
      method: 'POST',
      data: {
        'openid': that.data.openid,
        'page': page,
        'sort': sort
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        wx.hideLoading();
        if (res.data.status == 1) {
          if (pageAdd == 1) {
            that.setData({
              pageJs: parseInt(that.data.pageJs) + 1
            });
          }
          that.setData({
            isLoadingEndJs: res.data.isLoadingEnd,
            forumListJs: that.data.forumListJs.concat(res.data.forumList),
            isloading: false
          });
        } else {
          app.showTip(res.data.msg);
          that.setData({
            isloading: false,
            isLoadingEndJs: 1
          });
        }
      },
      fail: function (res) {
        wx.hideLoading();
        that.setData({
          isloading: false,
          isLoadingEndJs: 1
        })
      }
    });
  },

  //上拉获取攻略数据
  getListGl(page, sort, pageAdd) {
    var that = this;
    this.setData({
      isloading: true
    });
    console.log('加载更多');
    wx.showLoading({
      title: '加载中'
    });

    wx.request({
      url: that.data.baseUrl + 'getForumListGl.php',
      method: 'POST',
      data: {
        'openid': wx.getStorageSync('ly24_openid'),
        'page': page,
        'sort': sort
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        wx.hideLoading();
        if (res.data.status == 1) {
          if (pageAdd == 1) {
            that.setData({
              pageGl: parseInt(that.data.pageGl) + 1
            });
          }
          that.setData({
            isLoadingEndGl: res.data.isLoadingEnd,
            forumListGl: that.data.forumListGl.concat(res.data.forumList),
            isloading: false
          });
        } else {
          app.showTip(res.data.msg);
          that.setData({
            isloading: false,
            isLoadingEndGl: 1
          });
        }
      },
      fail: function (res) {
        wx.hideLoading();
        that.setData({
          isloading: false,
          isLoadingEndGl: 1
        })
      }
    });
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    //暂停加载或数据已加载完了直接返回空
    if (this.data.listType == 0) {
      //圈子下来
      if (this.data.isloading || this.data.isLoadingEnd == 1) {
        console.log('end');
        return;
      }
      this.getList(parseInt(this.data.page) + 1, this.data.sort, 1);
    } else if (this.data.listType == 2) {
      //家书下拉
      if (this.data.isloading || this.data.isLoadingEndJs == 1) {
        console.log('end');
        return;
      }
      this.getListJs(parseInt(this.data.pageJs) + 1, this.data.sort, 1);
    } else if (this.data.listType == 3) {
      //悦攻略下拉
      if (this.data.isloading || this.data.isLoadingEndGl == 1) {
        console.log('end');
        return;
      }
      this.getListGl(parseInt(this.data.pageGl) + 1, this.data.sort, 1);
    }

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
    var that = this;
    return {
      title: that.data.shareTitle,
      path: '/pages/square/index',
      imageUrl: that.data.shareImg,
      success: function (res) {

      },
      fail: function (res) {

      }
    }
  },
  // 分享朋友圈
  onShareTimeline() {
    var that = this;
    return {
      title: that.data.shareTitle,
      query: 'is_share=1',
      imageUrl: that.data.shareImg,
      success: function (res) {

      },
      fail: function (res) {

      }
    }
  }
})